import React from 'react'
import styles from './index.module.scss'
type Props = {
  hideList: () => void
  type: '' | 'photo' | 'gender'
  onUpdate: (key: string, value: string) => void
}
const genderList = [{ title: '男', value: '0' }, { title: '女', value: '1' }]

const photoList = [{ title: '拍照', value: '' }, { title: '本地选择', value: '' }]

const EditList = (props: Props) => {
  const list = props.type === 'gender' ? genderList : photoList
  return (
    <div className={styles.root}>
      {list.map((item) => (
        <div
          key={item.title}
          onClick={() => {
            props.onUpdate(props.type, item.value)
          }}
          className="list-item">
          {item.title}
        </div>
      ))}

      {/* <div className="list-item">男</div>
      <div className="list-item">女</div> */}

      <div onClick={props.hideList} className="list-item">
        取消
      </div>
    </div>
  )
}

export default EditList
